#!/bin/bash

isnowdir="u"
if [ "$1" == "--isnowdir" ]
then
    isnowdir="y"
fi
echo "LinuxGSM-For-China"
if [ "$isnowdir" == "u" ]
then
    read -p "是否要在当前目录下初始化？如果当前目录下有其他文件可能引发未知问题！(y/n)" isnowdir
fi
if [ "$isnowdir" == "n" ]
then
    git clone https://gitee.com/ccaicai/LinuxGSM
    chmod +x linuxgsm.sh
    chmod -R 764 lgsm/functions
    echo "初始化完成"
elif [ "$isnowdir" == "y" ]
then
    git clone --no-checkout https://gitee.com/ccaicai/LinuxGSM.git dltmp
    mv dltmp/.git .
    rm -rf dltmp
    git reset --hard HEAD
    chmod +x linuxgsm.sh
    chmod -R 764 lgsm/functions
    echo "初始化完成"
    echo "请使用 bash linuxgsm.sh 游戏 来执行"
elif [ "$isnowdir" == "u" ]
then
    echo "未选择是否在当前目录下初始化"
fi